草庐IT

ERROR: yaml.scanner.ScannerError: while scanning a simple key

全部标签

ruby-on-rails - bundle 安装 : ERROR: Failed to build gem native extension. nio4r gem

我目前正在使用以下项目进行项目:rvm1.26.11ruby2.2.1p85我尝试运行bundleinstall但不断收到以下错误:Gem::Ext::BuildError:ERROR:Failedtobuildgemnativeextension.并且,以下:Anerroroccurredwhileinstallingnio4r(1.0.0),andBundlercannotcontinue.Makesurethat`geminstallnio4r-v'1.0.0'`succeedsbeforebundling.当我尝试运行geminstallnio4r-v'1.0.0'时:Buil

ruby - 错误 : Error installing ffi: ERROR: Failed to build gem native extension

安装了DevKit并重新运行ffi安装…。将其作为输出:C:\DocumentsandSettings\******>geminstallffiTemporarilyenhancingPATHtoincludeDevKit...Buildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingffi:ERROR:Failedtobuildgemnativeextension.C:/Ruby192/bin/ruby.exeextconf.rbcheckingforffi.h...nocheckingforffi.hin

ruby - 在不破坏 anchor 和别名的情况下读写 YAML 文件?

我需要打开一个YAML文件,其中使用了别名:defaults:&defaultsfoo:barzip:buttonnode:这显然扩展为等效的YAML文档:defaults:foo:barzip:buttonnode:foo:otherzip:buttonYAML::load将其读取为。我需要在此YAML文档中设置新键,然后将其写回磁盘,尽可能保留原始结构。我看过YAML::Store,但这完全破坏了别名和anchor。是否有任何可用的东西:thing=Thing.load("config.yml")thing[:node][:foo]="yetanother"将文档另存为:defau

ruby-on-rails - 通过 ruby​​ 代码读取和更新 YAML 文件

我写了一个这样的yml文件:last_update:'2014-01-2811:00:00'我正在阅读这个文件config=YAML.load('config/data.yml')稍后我访问last_update_time作为config['last_update']但它不工作。另外我想通过我的ruby​​代码更新last_update_time就像它应该更新一样:last_update:'2014-01-2923:59:59'我不知道该怎么做。 最佳答案 将.load切换为.load_file,您应该可以开始了。#!/usr/bi

ruby-on-rails - 如何在 Ruby 中的 YAML 文件中包含 YAML 文件

在YAML中是否有自定义标签用于ruby​​将YAML文件包含在YAML文件中?#E.g.:---!includefilename:another.ymlAsimilar前段时间有人问过这个问题,没有相关的答案。我想知道是否有一些类似于this的Ruby自定义标签一个用于Python。 最佳答案 如果您使用Rails,YAML可以包含ERB。将它们结合在一起,这就是您可以使用的方法包含一个文件中的另一个文件:数据库.ymldatabase.sqlite.ymlsqlite:&defaultsadapter:sqlite3pool:5

ruby-on-rails - 移至生产服务器的 Rails 应用出现 "dump format error for symbol"错误

我刚刚将我的Rails应用程序从开发服务器转移到部署服务器。我已经安装了passenger,但我想尝试使用railss来确保一切正常(这是我第一次开发和部署rails应用程序)。规范是:Ruby1.9.3和RVM、mod_passenger、Rails3.2.3。全部安装正确,我还启用了Apache模块。顺便说一句,出了点问题(乘客一直在说“错误信息:未知key:类(class)”。)运行railss会出现上面列出的奇怪错误dumpformaterrorforsymbol(0x45)ProcessingbyDevise::SessionsController#newasHTMLRend

ruby - 如何对 YAML 文件进行排序?

我一直在尝试使用Ruby对i18n翻译YAML文件进行排序,以便我可以更好、更有条理地管理新翻译,但我一直在想是否有什么方法可以简化这项任务。我找到了一个YAML文件编写器,因此我可以将哈希写入文件,但我的问题是正确排序哈希。如果我得到散列h,h.sort会返回一个数组,但我仍然没有想出一个简单的方法来做到这一点。我有这样的YAML文件:pt-br:global:misc:total:"Total"all:"Todos"close:"Fechar"cancel:"Cancelar"crud:access:"Acessar"back:"Voltar"edit:"Editar"confir

ruby-on-rails - Ruby on Rails Rake Assets :precompile error

我是Rails开发的新手,这是我第一次部署到Heroku。当我执行我的应用程序时(部署后)出现错误:2011-09-18T21:05:54+00:00app[web.1]:Completed500InternalServerErrorin10ms2011-09-18T21:05:54+00:00app[web.1]:2011-09-18T21:05:54+00:00app[web.1]:ActionView::Template::Error(application.cssisn'tprecompiled):我在谷歌上搜索了一下,发现我必须预编译我的Assets,但在尝试这样做时我发现了

ruby-on-rails - ERROR : While executing gem . .. (TypeError) 不兼容的编码文件格式(无法读取)

我在使用Ruby2.4.4版和macOSMojave运行bundleinstall时遇到了这个问题:Fetchingnokogiri1.8.5Installingnokogiri1.8.5withnativeextensionsGem::Ext::BuildError:ERROR:Failedtobuildgemnativeextension.ERROR:cannotdiscoverwherelibxml2islocatedonyoursystem.pleasemakesure`pkg-config`isinstalled.所以我跑了xcode-select--install但是当我运

【笔记】internal/modules/cjs/loader.js:985 throw err; ^ Error: Cannot find module ‘node:util‘

[root@localhostusr]#cnpm-vinternal/modules/cjs/loader.js:985throwerr;^Error:Cannotfindmodule‘node:util’Requirestack:/usr/local/node/lib/node_modules/cnpm/bin/cnpmatFunction.Module._resolveFilename(internal/modules/cjs/loader.js:982:15)atFunction.Module._load(internal/modules/cjs/loader.js:864:27)atM